import React, { Component } from "react";
import { Route, Routes } from "react-router-dom";
import Header from "./components/Header";
import MyNavLink from "./components/MyNavLink";
import About from "./pages/About";
import Home from "./pages/Home";

export default class App extends Component {
    render() {
        return (
            <div>
                <div className="row">
                    <div className="col-xs-offset-2 col-xs-8">
                        <Header />
                    </div>
                </div>
                <div className="row">
                    <div className="col-xs-2 col-xs-offset-2">
                        <div className="list-group">
                            {/* <a href="./about.html" className="list-group-item"></a>
                            <a href="./about.html" className="list-group-item active"></a> */}
                            {/* 注册路由链接 */}
                            <MyNavLink to="/atguigu/about">About</MyNavLink>
                            <MyNavLink to="/atguigu/home">Home</MyNavLink>
                        </div>
                    </div>
                    <div className="col-xs-6">
                        <div className="panel">
                            <div className="panel-body">
                                {/* 注册路由 新版本 Switch变为Routes */}
                                <Routes>
                                    <Route
                                        path="/atguigu/about"
                                        element={<About />}
                                    />
                                    <Route
                                        path="/atguigu/home"
                                        element={<Home />}
                                    />
                                </Routes>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        );
    }
}
